package com.ihr360.cnb.module.payroll.service;

import com.ihr360.commons.entity.AuthUserInfo;
import com.ihr360.commons.vo.PageData;
import com.ihr360.commons.vo.ResultInfo;
import com.ihr360.entity.SyncedRosterSalaryChangeRecordEntity;
import com.ihr360.payroll.entity.staff.StaffPayrollInfoJournalEntity;
import com.ihr360.payroll.entity.staff.StaffSalaryEntity;
import com.ihr360.payroll.request.ApplicationApprovalRequest;
import com.ihr360.payroll.request.StaffPayrollInfoJournalRequest;
import com.ihr360.payroll.request.StaffPayrollInfosRequest;
import com.ihr360.payroll.request.StaffSalaryProfileSearchBody;
import com.ihr360.payroll.request.attendance.AttendanceTakeNumberRequest;
import com.ihr360.payroll.response.StaffPayrollInfoResponse;
import com.ihr360.payroll.type.AttendanceState;

import javax.servlet.ServletOutputStream;
import java.util.List;
import java.util.Map;

/**
 * @author richey
 */
public interface PayrollAggregateService {

    /**
     * 薪资上线前初始化员工薪资转正数据
     *
     * @return
     */
    Boolean initIrsProbationData();

    /**
     * 公司薪资档案批量初始化,只可以在上线前数据迁移时运行
     *
     * @return
     */
    ResultInfo batchInitCompanySalaryProfile();

    /**
     * 初始化除员工转正数据之外的其他员工数据
     *
     * @return
     */
    ResultInfo initExcludeFromIrs();

    void takeNumber(AuthUserInfo userInfo, AttendanceTakeNumberRequest request);

    Map<String, Integer> getUnapprovedCount(String companyId, AttendanceTakeNumberRequest request);

    void saveStaffSalaryInfo(List<String> staffIds, StaffSalaryEntity staffSalaryEntity);


    /**
     * 转正/调岗调薪-->员工薪资
     *
     * @param entity
     * @return
     */
    ResultInfo adjustStaffSalaryProfile(SyncedRosterSalaryChangeRecordEntity entity);

    String submitApproval(AuthUserInfo userInfo, ApplicationApprovalRequest applicationApprovalRequest);

    /**
     * 考勤汇总锁定/撤销锁定
     */
    void lockAttendanceState(AuthUserInfo userInfo, Long summaryId, AttendanceState state);

    void initStaffBankInfo();

    /**
     * 获取员工薪资记录
     *
     * @param param
     * @return
     */
    StaffPayrollInfoResponse getCurrentEffectiveStaffSalarys(StaffSalaryProfileSearchBody param,boolean noPaged);

    /**
     * 调整员工薪资档案数据
     *
     * @param staffIdList   用于权限校验
     * @param staffpayrollInfos
     * @return
     */
    ResultInfo adjustSalaryProfileWrapper(List<String> staffIdList, StaffPayrollInfosRequest staffpayrollInfos);

    /**
     * 导出当前员工薪资数据
     * @param param
     * @param outputStream
     */
    void exportCurrent(StaffSalaryProfileSearchBody param, ServletOutputStream outputStream);

    PageData<StaffPayrollInfoJournalEntity> findAllJournals(StaffPayrollInfoJournalRequest param);
}
